﻿/*******************************************************************************
 * Copyright @ 2017 YunSpace.Framework 版权所有
 * Author: GaoTang
 * Description: YunSpace 快速开发平台
 * Website：http://www.yunspace.com.cn
*********************************************************************************/
#region USING SYSTEM
using YunSpace.Core;
using YunSpace.Domain.Entity.SiteMgr;
using YunSpace.Domain.IRepository.SiteMgr;
using YunSpace.Repository.SiteMgr;
using System.Collections.Generic;
using System.Linq;
#endregion

namespace YunSpace.Application.SiteMgr
{
    public class ClientReturnvisitrecordApp
    {
        private IClientReturnvisitrecordRepository service = new ClientReturnvisitrecordRepository();

        public List<ClientReturnvisitrecordEntity> GetList(string keyword = "")
        {
            var expression = ExtLinq.True<ClientReturnvisitrecordEntity>();
            // if (!string.IsNullOrEmpty(keyword))
            // {
            //     expression = expression.And(t => t.F_FullName.Contains(keyword));
            //     expression = expression.Or(t => t.F_EnCode.Contains(keyword));
            // }
            // expression = expression.And(t => t.F_Category == 2);
            return service.IQueryable(expression).OrderBy(t => t.F_Id).ToList();
        }

        public ClientReturnvisitrecordEntity GetForm(string keyValue)
        {
            return service.FindEntity(keyValue);
        }
        public void DeleteForm(string keyValue)
        {
            service.Delete(t => t.F_Id == keyValue);
        }
        public void SubmitForm(ClientReturnvisitrecordEntity clientReturnvisitrecordEntity, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                clientReturnvisitrecordEntity.Modify(keyValue);
                service.Update(clientReturnvisitrecordEntity);
            }
            else
            {
                clientReturnvisitrecordEntity.Create();
                // clientReturnvisitrecordEntity.F_Category = 2;
                service.Insert(clientReturnvisitrecordEntity);
            }
        }
    }
}

